package com.zxmr.domain.service;

import java.util.List;

import com.zxmr.CommonInit;
import com.zxmr.db.DBManager;
import com.zxmr.domain.activity.Activity;
import com.zxmr.domain.activity.ActivityEntity;

public class ActivityService {

	DBManager db = CommonInit.getDBManager();
	
	@SuppressWarnings("unchecked")
	public List<Activity> queryAllActivity(ActivityEntity entity, long entityId) 
	{
		try
		{
			Activity activity = new Activity();
			activity.setEntity(entity);
			activity.setEntityId(entityId);
			
			return (List<Activity>)db.getMapper().queryForList("activity.queryActivity", activity);
		}catch(Exception e){
			e.printStackTrace();
		}
		
		return null;
	}
	
	public void addActivity(Activity activity) {
		try
		{
			db.getMapper().insert("activity.addActivity", activity);
		}catch(Exception e){
			e.printStackTrace();
		}
	}
}
